package com.laowang.project.system.mapper;

import java.util.List;

import com.laowang.project.system.domain.ZcActivity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 众筹活动Mapper接口
 *
 * @author laowang
 * @date 2025-09-09
 */
public interface ZcActivityMapper {
    /**
     * 查询众筹活动
     *
     * @param id 众筹活动ID
     * @return 众筹活动
     */
     ZcActivity selectZcActivityById(Integer id);

    /**
     * 查询众筹活动列表
     *
     * @param zcActivity 众筹活动
     * @return 众筹活动集合
     */
     List<ZcActivity> selectZcActivityList(ZcActivity zcActivity);

    /**
     * 新增众筹活动
     *
     * @param zcActivity 众筹活动
     * @return 结果
     */
    int insertZcActivity(ZcActivity zcActivity);

    /**
     * 修改众筹活动
     *
     * @param zcActivity 众筹活动
     * @return 结果
     */
    int updateZcActivity(ZcActivity zcActivity);

    /**
     * 删除众筹活动
     *
     * @param id 众筹活动ID
     * @return 结果
     */
    int deleteZcActivityById(Integer id);

    /**
     * 批量删除众筹活动
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    int deleteZcActivityByIds(Integer[] ids);

    ZcActivity selectZcActivityDetailById(@Param("id") Integer id);

    @Select("SELECT COUNT(zwo.user_id) FROM zc_activity za\n" +
        "LEFT JOIN zc_wx_order zwo on zwo.activity_id = za.id\n" +
        "WHERE za.id=#{activityId} ")
    Integer selectCountOrder(Integer activityId);
}
